<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Map_model extends CI_Model {
    function __construct()
    {
        parent::__construct();
    }
	
	function ww_update_training_military($uid, $land, $pos, $unit, $quantity, $lquantity, $timestamp, $eachtime, $fixtime, $status)
	{
		/*
		*	$troop_code = uid:
			$unit = ma quan;
			$amt = so luong;
			$timestamps = thoi gian tao
			$eachtime = so giay hoan thanh
		*
		*/
		$query = $this->db->query("CALL ww_update_training_military($uid, $land, $pos, $unit, $lquantity, $quantity, $timestamp, $eachtime, $fixtime, $status);");
		$this->db->close();
		return $query->result();
	}
	
	function ww_get_train_user_info($uid, $type)
	{
		$query = $this->db->query("CALL ww_get_train_user_info($uid, $type);");
		$this->db->close();
		return $query->result_array();
	}
	function ww_get_units_user_info($uid, $land)
	{
		$query = $this->db->query("CALL ww_get_units_user_info($uid, $land);");
		$this->db->close();
		return $query->row();
	}
	function ww_update_quantity_military($uid, $id)
	{
		$query = $this->db->query("CALL ww_update_quantity_military($uid, $id);");
		$this->db->close();
		return $query->row();
	}
	
	function ww_update_quantity_for_time($id, $uid, $timestamp, $eachtime, $quantity)
	{
		$query = $this->db->query("CALL ww_update_quantity_for_time($id, $uid, $timestamp, $eachtime, $quantity);");
		$this->db->close();
		return $query->row();
	}
	function ww_update_res_by_hour($uid, $food, $wood, $metal, $petroleum, $time)
	{
		$query = $this->db->query("CALL ww_update_res_by_hour($uid, $food, $wood, $metal, $petroleum, $time);");
		$this->db->close();
		return $query->row();
	}
	function ww_get_res_user_info($uid)
	{
		$query = $this->db->query("CALL ww_get_res_user_info($uid);");
		$this->db->close();
		return $query->row();
	}
}